﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.SessionState;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;

namespace LogManager.IoC
{
    /// <summary>
    /// note: from http://kennytordeur.blogspot.com/2011/09/asp-net-mvc-and-unity-navigating.html
    /// </summary>
    public class UnityControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            return DependencyResolver.Current.GetService(controllerType) as IController;
        }
    }
}